package com.stylefeng.guns;

import com.stylefeng.guns.core.util.CmdUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

import javax.annotation.PostConstruct;
import java.util.Date;
import java.util.TimeZone;

/**
 * SpringBoot方式启动类
 *
 * @author stylefeng
 * @Date 2017/5/21 12:06
 */
@SpringBootApplication
public class GunsApplication {

    private final static Logger logger = LoggerFactory.getLogger(GunsApplication.class);

    @PostConstruct
    void started() {
        TimeZone.setDefault(TimeZone.getTimeZone("Asia/Shanghai"));
        System.out.println("---------------------------------");
        System.out.println(new Date());
        System.out.println("---------------------------------");
    }

    public static void main(String[] args) {
        String unlockCmd = "security unlock-keychain -p Pafic1*2$0305";
        String res = CmdUtil.cmd(unlockCmd);
        logger.info("init cmd: {}", res);
        SpringApplication.run(GunsApplication.class, args);
        logger.info("GunsApplication is success!");
    }
}
